# Google sparse/dense hash
IF (SPARSEHASH_FOUND)
    ADD_DEFINITIONS(-DUSE_SPARSEHASH)
    INCLUDE_DIRECTORIES(SYSTEM ${SPARSEHASH_INCLUDE_DIRS})
ENDIF (SPARSEHASH_FOUND)

# Enumerate source files
FILE(GLOB_RECURSE SRC_FILES *.cpp *.c)
FILE(GLOB_RECURSE INC_FILES */*.h)

INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})

# Add executable and library
ADD_LIBRARY(Mesh SHARED ${SRC_FILES} ${INC_FILES})
TARGET_INCLUDE_DIRECTORIES(Mesh SYSTEM PUBLIC ${EIGEN_INCLUDE_DIRS})
TARGET_INCLUDE_DIRECTORIES(Mesh SYSTEM PUBLIC ${EIGEN_INCLUDE_DIRS}/unsupported)
TARGET_COMPILE_DEFINITIONS(Mesh PUBLIC -DEIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET)

# Add MKL if found
IF (MKL_FOUND)
    TARGET_INCLUDE_DIRECTORIES(Mesh SYSTEM PUBLIC ${MKL_INCLUDE_DIR})
    TARGET_LINK_LIBRARIES(Mesh ${MKL_LIBRARIES})
    TARGET_COMPILE_DEFINITIONS(Mesh PUBLIC
        -DEIGEN_USE_BLAS -DEIGEN_USE_LAPACKE)
ENDIF (MKL_FOUND)
